home *** CD-ROM | disk | FTP | other *** search
Wrap
<% ' Never cache this response Response.Expires = 0 ' Get data from their request total = Request.form("total") ccnum = Request.form("ccnum") ccdate = Request.form("ccdate") email = Request.form("email") If total = 0 Then ' They did not order anything message = "Please check your order. You did select any items." response.write("message="+URLEncode(message)+"&confirm=2") ElseIf Len(ccnum) < 6 And Len(ccdate) < 4 Then ' The order failed message = "Please enter a credit card number and expiration date." response.write("message="+URLEncode(message)+"&confirm=2") Else ' Generate an order number Randomize orderno = Int(500000+Rnd(1)*100000) message = "Thank you for your order. Your account was charged " & total & ". Your order number is " & orderno & ". We will send e-mail confirmation to " & email & " when your order ships." response.write("message="+URLEncode(message)+"&confirm=1") End If ' Encode a number from 0..15 to a single hex digit Function HexChar(ByVal i) If i < 10 Then HexChar = Chr(i+Asc("0")) Else HexChar = Chr(i-10+Asc("A")) End If End Function ' Encode the control and punctuation characters in a string to %xx hex values Function URLEncode(ByVal s) Dim result, ch Do While Len(s) > 0 ch = Asc(s) s = Right(s, Len(s)-1) If (ch >= Asc("a") And ch <= Asc("z")) Or (ch >= Asc("A") And ch <= Asc("Z")) Or (ch >= Asc("0") And ch <= Asc("9")) Then result = result & Chr(ch) ElseIf ch = Asc(" ") Then result = result & "+" Else 'result = result & "*" & ch 'result = result & "!" & (ch/16) & (ch mod 16) result = result & "%" & HexChar(Int(ch/16)) & HexChar(ch Mod 16) End If Loop URLEncode = result End Function %>